<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>要求页面上三个链接:淘宝,京东,拼多多</h1>
		<h2>使用js访问a标签的</h2>
		<div>
			<a name="tb" href="http://www.taobao.com" target="_blank">淘宝</a>
			<a class="jd" href="http://jingdong.com" target="_blank">京东</a>
			<a id="pdd" href="http://pinduoduo.com" target="_blank">拼多多</a>
		</div>
		<script>
			//name
			var tb=document.getElementsByName("tb")[0].href;
			console.log(tb)
			//class
			var jd=document.getElementsByClassName("jd")[0].href;
			console.log(jd)
			//id
			var pdd=document.getElementById("pdd").href;
			console.log(pdd)
			
			
		</script>
	</body>
</html>
